<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>

        .c{
            color:red;
            margin-left:4px;
            display:inline-block;
        }
        .l{
            font-size:18px;
        }
        .d{
            height:35px;
            width:300px;
            display:inline;
        }
        .i{
            height:30px;
            width:300px;
            border-radius:8px;
        }
        .w{
            padding-left: 30px;
            /*background-color: #c2c2c2;*/
            background-color: rgba(96, 96, 96, 0.5);
            position: absolute;
            margin: auto;
            top:0;
            left:0;
            bottom:0;
            right: 0;
            font-family: 微软雅黑;
            font-weight:500;
            border:2px solid #505050;
            border-radius:25px;
        }
        .dl{
            border-radius:8px;
            height: 40px;
            width: 130px;
        }
        .zhucexinyonghu{
            padding-left:38%;
            color: #000000;
            font-family: 楷体;
            font-weight:600;
            font-size: 80px;
        }
        .anniu{
            padding-left:14%;
            padding-bottom: 70%;
        }
        select{
            height: 30px;
            width: 75px;
        }
        body {
            margin: 0;
            padding: 0;
            background-size:100%;
        }
    </style>
    <script src="/resources/resources/scripts/jquery-1.7.1.min.js" type="application/javascript"></script>
</head>
<script>


    //登录
    function login() {
        var fromdata = $("#form2").serialize();
        console.log(fromdata);
        $.ajax({
            url:"/login",
            data:fromdata,
            type:"post",
            dataType:"json",
            success:function (data) {
                if($("input[name='userAccount']").val() == null || $("input[name='userAccount']").val() == ""){
                    alert("请输入账号！");
                }else if($("input[name='userPasswrod']").val() == null || $("input[name='userPasswrod']").val() == ""){
                    alert("请输入密码！");
                }else{
                    if(data>0){
                        location.href="/toMain";
                        return;
                    }else if(data==0){
                        alert("密码错误");
                    }else if(data==-1){
                        alert("尚未授权");
                    }else {
                        alert("账号不存在");
                    }
                    return;
                }
            }
        })
    }
</script>
<body style="background-image:url(/resources/images/zhucexinxitupian/jinghui.jpg)">

<form  id="form2" enctype="multipart/form-data" method="post" accept-charset="utf-8" >

     <div class="w" style="width:530px;height:450px;/*float:left;margin:0 20px;*/">
         <br/>
         <div style="font-size:38px;" class="zhucexinyonghu">登录</div>
        <br/>

        <br/><br/>
        <span class="c">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*</span>
        <label for="login_password" class="l">账号:</label>
        <div  class="d">
            <input id="login_password" type="text" class="i" name="userAccount">
        </div>
        <br/><br/><br/><br/>
        <span class="c">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*</span>
        <label for="confirm_password" class="l">密码:</label>
        <div  class="d">
            <input id="confirm_password" type="password" class="i" name="userPasswrod">
        </div>
        <br/><br/>
         <br/><br/>


        <div class="anniu">
        <input type="button" class="dl" onclick="window.location='resources/zhece.html'" value="注册"/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" class="dl" onclick="login()" value="登录"/>
        </div>
     </div>
    </div>
</form>
</body>
</html>
